package com.mx.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mx.domain.User;
import com.mx.domain.UserRepository;

@Controller
@RequestMapping("/user")
public class UserController {

	@Autowired
	private UserRepository userRepository;
	
	@RequestMapping("/list")
	@ResponseBody
	public List<User> list(){
		return userRepository.findAll();
	}
	
	@RequestMapping("/userList")
	public String userList(Model model){
		model.addAttribute("message", "你好");
		return "userList";
	}
}
